<template>
	<view>
		<u-navbar :border-bottom="false" :customBack="saveBack"  title="我的通知" title-color="#fff" back-icon-color="#fff"></u-navbar>
		<!-- 通知列表 -->
			<view class="examList">
			 <my-an-item v-for="(paper,index) in list"  :key="paper.noticeid"  :itemName="paper.name"  @click.native="gotoLink(paper.noticeid)">
			 	<view slot="botLeft">
			 		<my-icon name="time"></my-icon>
			 		<text class="botTxt">发布时间：{{paper.createtime}}</text>
			 	</view>
				<view slot="right" class="ft40">
					<view class="clockIcon"><my-icon name="bd-next"></my-icon></view>
				</view>
			 </my-an-item>
			 <my-empty v-if="emptyFlase" emptyTit="暂无通知"></my-empty>
	  	</view>
			<!-- 悬浮按钮 -->
			<view class="slideNav" @click="creatExam"><my-icon name="fabukaoshi1"></my-icon></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				taskId:0,
				emptyFlase:false
			}
		},
		onLoad(){
			this.init()
		},
		methods: {
			init(){
				this.list=[]
				return this.getInfo();
			},
			creatExam(){
				const sess=uni.getStorageSync('examStorage')?uni.getStorageSync('examStorage'):{};
				sess.studentlist='';
				sess.studentName='';
				uni.setStorageSync('examStorage', sess)
				uni.navigateTo({
					url:'setNotice'
				})
			},
			gotoLink(id){
				uni.navigateTo({
					url:'noticeDetail?noticeid='+id
				})
			},
			saveBack(){
				uni.switchTab({
					url:"../user"
				})
			},
			getInfo(){
				return new Promise((resolve, reject) => {
					  this.request
						.get('/app/teacher/notice/getNoticeList')
						.then(res => {
							this.list=res
							this.emptyFlase=this.list.length>0?false:true
							resolve();
						})
				});
			}
		}
	}
</script>
<style lang="scss" scoped>
	.clockIcon{
		display: flex;
		justify-content: center;
		align-items: center;
		margin-top: 30upx;
		.iconfont{
			color: #CCCCCC;
			font-size: 28upx;
			font-weight: normal;
			transform: scale(1);
		}
	}
	.paper-item{
		position: relative;
		.ft40{
			position: absolute;
			right: 30upx;
			top: 40upx;
		}
	}
	/deep/.name{
		.content{
			width: 92%;
	}
	}
	.slideNav{
			 position: fixed;
			 bottom: 50upx;
			 right: 30upx;
			 width: 100upx;
			 height: 100upx;
			 border-radius: 100upx;
			 text-align: center;
			 line-height: 100upx;
			 background: linear-gradient( #FC7767 0%, #EC412F 100%);
			 box-shadow: 0px 3upx 14upx 0px rgba(244,92,75,0.4);
			 .iconfont{
				 color: #fff;
				 font-size: 42upx;
			 }
	}
</style>
